<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <title>对账管理</title>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="stylesheet" href="../../../elementUI/index.css">
    <link rel="stylesheet" href="../../../css/index.css">
</head>

<body>
    <div id="app" class="minWidth">
        <el-form :inline="true" :form="form">
            <el-form-item label="供应商:">
                <el-select placeholder="请选择供应商" clearable filterable v-model.trim="form.Tax_Number" @change="handleclassify">
                    <el-option v-for="(item,index) in supplier" :key="index" :label="item.Supplier_Name" :value="item.Supplier_SerialNumber"></el-option>
                </el-select>
            </el-form-item>
            <el-form-item label="商品名称:">
                <el-input v-model.trim="form.Article_Name" @change="handleclassify" placeholder="请输入商品名称"></el-input>
            </el-form-item>
            <el-form-item label="时间范围:">
                <el-date-picker v-model="time" style="margin-right: 20px;" value-format="yyyy-MM-dd"
                    @change="DateChange" type="daterange" align="center" unlink-panels range-separator="至"
                    start-placeholder="开始日期" end-placeholder="结束日期" :picker-options="pickerOptions">
                </el-date-picker>
            </el-form-item>
        </el-form>
        <div>
            <el-col :span="8" style="width: 33.3%;">
                <el-card shadow="hover" style="margin: 30px;">
                    <h3>采购成本:￥{{thousands(Number(Data.Purchase_Amount))}}</h3>
                </el-card>
            </el-col>
            <el-col :span="8" style="width: 33.3%;">
                <el-card shadow="hover" style="margin: 30px;">
                    <h3>采购支出:￥{{thousands(Number(Data.Paid_Amount))}}</h3>
                </el-card>
            </el-col>
            <el-col :span="8" style="width: 33.3%;">
                <el-card shadow="hover" style="margin: 30px;">
                    <h3>待付金额:￥{{thousands(Number(Data.Purchase_Amount)-Number(Data.Paid_Amount))}}</h3>
                </el-card>
            </el-col>
        </div>
        <el-table height="calc(100vh - 300px)" :data="tableData" stripe border style="width: 100%">
            <el-table-column type="index" align="center" width="50" label="序号"></el-table-column>
            <el-table-column prop="Article_Name" align="center" label="商品名称"></el-table-column>
            <el-table-column prop="Quantity" align="center" label="采购数量">
                <template v-slot="{row}">
                    {{Number(row.Quantity)}}
                </template>
            </el-table-column>
            <el-table-column prop="Unit" width="50" align="center" label="单位">
                <template v-slot="{row}">
                    {{row.Unit.split('/')[0]}}
                </template>
            </el-table-column>
            <el-table-column prop="Sales_Amount" align="center" label="应付金额">
                <template v-slot="{row}">
                    {{thousands(Number(row.Purchase_Amount))}}
                </template>
            </el-table-column>
            <el-table-column prop="Paid_Amount" align="center" label="已付金额">
                <template v-slot="{row}">
                    {{thousands(Number(row.Paid_Amount))}}
                </template>
            </el-table-column>
            <el-table-column  align="center" label="待付金额">
                <template v-slot="{row}">
                   <span :style="(Number(row.Purchase_Amount).toFixed(2))-(Number(row.Paid_Amount).toFixed(2))!=0?'color:red':'color:green'">{{thousands((Number(row.Purchase_Amount).toFixed(2))-(Number(row.Paid_Amount).toFixed(2)))}}元</span>  
                </template>
            </el-table-column>
            <el-table-column prop="Supplier_Name" align="center" label="供应商"></el-table-column>
        </el-table>
        <el-pagination background v-show="total > 0" @size-change="handleSizeChange"
            @current-change="handleCurrentChange" :current-page="form.page" :page-sizes="[10,20,30,50]"
            :page-size="form.limit" layout="total, sizes, prev, pager, next, jumper" :total="total">
        </el-pagination>


    </div>
    <script type="text/javascript" src="../../../js/jquery-3.6.0.min.js"></script>
    <script type="text/javascript" src="../../../js/jquery.cookie.js"></script>
    <script type="text/javascript" src="../../../js/vue.min.js"></script>
    <script type="text/javascript" src="../../../elementUI/index.js"></script>
    <script type="text/javascript" src="../../../js/utils.js"></script>
    <script type="text/javascript" src="./js/PurchaseReconciliation.js"></script>
</body>

</html>